%2multibyte Version: 5.50.0.2953 CodePage: 1252
%% This document created by Scientific Word (R) Version 2.0
%\usepackage{sw20elba}
%\input tcilatex


\documentclass[thmsa,notitlepage,11pt]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%TCIDATA{TCIstyle=Article/art1.lat,elba,article}

%TCIDATA{OutputFilter=LATEX.DLL}
%TCIDATA{Version=5.50.0.2953}
%TCIDATA{Codepage=1252}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{Created=Tue Nov 13 06:24:53 2001}
%TCIDATA{LastRevised=Tuesday, August 25, 2015 17:04:11}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
%TCIDATA{Language=American English}

\input{tcilatex}
\begin{document}

\author{Richard Dennis\thanks{%
Email: richard.dennis@glasgow.ac.uk} \\
%EndAName
University of Glasgow}
\title{\textbf{Package Guide for SolveDSGE}\vspace{0.2in}}
\date{August 25, 2015}
\maketitle

\thispagestyle{empty}\newpage \setlength{\baselineskip}{18.95pt}%
\setcounter{page}{1}

\section{Overview}

SolveDSGE is a Julia package aimed at macroeconomics interested in solving
Dynamic Stochastic General Equilibrium (DSGE) models. \ The package provides
routines for solving rational expectations models and for solving optimal
policy problems. \ Using this package, DSGE models can be solved in logs or
levels to first- or second-order accuracy and optimal policy problems can be
solved under discretion, commitment, timeless-perspective commitment, and
quasi-commitment. \ Routines that solve robust-control versions of these
policy problems are in the works. \ Although there is much that this package
does not do, SolveDSGE offers a broad array of solution methods that can be
applied provided the DSGE model can be expressed in one of several standard
dynamic representations.

\section{Installation}

To install SolveDSGE you will need to type the following into the Julia REPL

\bigskip

\textbf{Pkg.add("SolveDSGE")}

\bigskip

\section{Solving rational expectations models}

\subsection{First-order-accurate solution methods}

SolveDSGE provides a range of solution methods for computing first-order
accurate solutions. \ Exploiting Julia's multiple dispatch all of these
solution methods are called via the single command \textbf{solve\_re}(). \
From this single command the particular solution method employed depends
principally on the model type that enters the \textbf{solve\_re()} function
call. \ Models are represented in various forms that are summarized by
types. \ The model types are

\begin{itemize}
\item \textbf{Blanchard\_Kahn\_Form}

\item \textbf{Klein\_Form}

\item \textbf{Sims\_Form}

\item \textbf{Binder\_Pesaran\_Form}
\end{itemize}

\subsubsection{Blanchard-Kahn form}

The Blanchard-Kahn Form is given by%
\[
\left[ 
\begin{array}{c}
\mathbf{x}_{t+1} \\ 
\text{E}_{t}\mathbf{y}_{t+1}%
\end{array}%
\right] =\mathbf{A}\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{y}_{t}%
\end{array}%
\right] +\mathbf{C}\left[ \mathbf{\epsilon }_{t+1}\right] , 
\]%
$\mathbf{\epsilon }_{t}\sim i.i.d.[\mathbf{0},\mathbf{\Sigma }]$, where $%
\mathbf{x}_{t}$ is an $n_{x}\times 1$ vector of predetermined variables and $%
\mathbf{y}_{t}$ is an $n_{y}\times 1$ vector of non-predetermined variables.
\ To solve models of this form we first create the \textbf{%
Blanchard\_Kahn\_Form} type for the model, then we use \textbf{solve\_re()}
to solve the model. \ The relevant lines of code would be something like

\bigskip

\textbf{cutoff = 1.0}

\textbf{model = Blanchard\_Kahn\_Form(nx,ny,a,c,sigma)}

\textbf{soln = solve\_re(model,cutoff)}

\bigskip

Here \textbf{soln} contains the solution, which is of the form%
\begin{eqnarray*}
\mathbf{x}_{t+1} &=&\mathbf{Px}_{t}+\mathbf{K\epsilon }_{t+1}, \\
\mathbf{y}_{t} &=&\mathbf{Fx}_{t},
\end{eqnarray*}%
and information about the number of eigenvalues with modulus greater than
cutoff and whether the \textquotedblleft solution\textquotedblright\
returned is determinate, indeterminate, or explosive.

Models of the \textbf{Blanchard\_Kahn\_Form} type can also be solved using
an iterative method to solve a non-symmetric, continuous, algebraic, Riccati
equation. \ In this case the relevant lines of code might look like

\bigskip

\textbf{tol = 1e-10}

\textbf{cutoff = 1.0}

\textbf{model = Blanchard\_Kahn\_Form(nx,ny,a,c,sigma)}

\textbf{soln = solve\_re(model,cutoff,tol)}

\bigskip

For this iterative method, the variable \textbf{cutoff} is still used to
establish determinacy, but is not used to order eigenvalues.

\subsubsection{Klein form}

The Klein Form for a model is given by%
\[
\mathbf{B}\left[ 
\begin{array}{c}
\mathbf{x}_{t+1} \\ 
\text{E}_{t}\mathbf{y}_{t+1}%
\end{array}%
\right] =\mathbf{A}\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{y}_{t}%
\end{array}%
\right] +\mathbf{C}\left[ \mathbf{\epsilon }_{t+1}\right] , 
\]%
$\mathbf{\epsilon }_{t}\sim i.i.d.[\mathbf{0},\mathbf{\Sigma }]$, where $%
\mathbf{x}_{t}$ is an $n_{x}\times 1$ vector of predetermined variables, $%
\mathbf{y}_{t}$ is an $n_{y}\times 1$ vector of non-predetermined variables,
and $\mathbf{B}$ need not have full rank. \ We can solve models of this form
using the code

\bigskip

\textbf{cutoff = 1.0}

\textbf{model = Klein\_Form(nx,ny,a,b,c,sigma)}

\textbf{soln = solve\_re(model,cutoff) }

\bigskip

The composite type \textbf{soln} contains the solution which is of the form%
\begin{eqnarray*}
\mathbf{x}_{t+1} &=&\mathbf{Px}_{t}+\mathbf{K\epsilon }_{t+1}, \\
\mathbf{y}_{t} &=&\mathbf{F}x_{t},
\end{eqnarray*}%
as well as information about the number of eigenvalues that have modulus
greater than cutoff and whether the \textquotedblleft
solution\textquotedblright\ returned is determinate, indeterminate, or
explosive.

\subsubsection{Sims form}

An alternative model form is used by Sims (2000) and is given by%
\[
\mathbf{\Gamma }_{0}\mathbf{z}_{t}=\mathbf{\Gamma }_{1}\mathbf{z}_{t-1}+%
\mathbf{C}+\mathbf{\Psi v}_{t}+\mathbf{\Pi \eta }_{t}, 
\]%
where $\mathbf{v}_{t}$ is a shock process, possibly serially correlated,
with mean-zero innovations whose variance-covarince matrix is given by $%
\mathbf{\Sigma }$. \ To solve models that are in this form we would do
something like the following

\bigskip

\textbf{cutoff = 1.0}

\textbf{model = Sims\_Form(gamma0,gamma1,c,psi,pi,sigma)}

\textbf{soln = solve\_re(model,cutoff)}

\bigskip

Here the solution, summarized by \textbf{soln}, is of the form%
\[
\mathbf{z}_{t}=\mathbf{G}_{1}\mathbf{z}_{t-1}+\mathbf{c}+\mathbf{impact}%
\times \mathbf{v}_{t}+\mathbf{ywt}\times \left[ \mathbf{I}-\mathbf{fmat}%
\times L^{-1}\right] ^{-1}\times \mathbf{fwt}\times \mathbf{v}_{t+1}. 
\]

\subsubsection{Binder-Pesaran form}

A model is in \textquotedblleft structural form\textquotedblright\ if it is
written as%
\[
\mathbf{Az}_{t}=\mathbf{A}_{1}\mathbf{z}_{t-1}+\mathbf{B}\text{E}_{t}\mathbf{%
z}_{t+1}+\mathbf{C\epsilon }_{t}, 
\]%
where $\mathbf{\epsilon }_{t}\sim i.i.d.[\mathbf{0},\mathbf{\Sigma }]$. \ We
have two ways of solving structural form models. \ The first recasts them in
terms of the Klein form and here the relevant code would look something like

\bigskip

\textbf{cutoff = 1.0}

\textbf{model = Binder\_Pesaran\_Form(a,a1,b,c,sigma)}

\textbf{soln = solve\_re(model,cutoff)}

\bigskip

The second method is iterative, implementing Binder and Pesaran's
\textquotedblleft brute force\textquotedblright\ method; here the code would
be something like

\bigskip

\textbf{tol = 1e-10}

\textbf{cutoff = 1.0}

\textbf{model = Binder\_Pesaran\_Form(a,a1,b,c,sigma)}

\textbf{soln = solve\_re(model,cutoff,tol)}

\bigskip

Regardless of which of the two methods is used, the solution, summarized in 
\textbf{soln}, has the form%
\[
\mathbf{z}_{t}=\mathbf{Pz}_{t-1}+\mathbf{K\epsilon }_{t}. 
\]%
As earlier, \textbf{soln} is a composite type that in addition to the
solution itself also contains information about the number of eigenvalues
with modulus greater than cutoff and whether the solution returned is
determinate, indeterminate, or explosive.

\subsection{Second-order-accurate solution methods}

In addition to the first-order accurate solution methods documented above,
SolveDSGE also contains two methods form obtaining second-order-accurate
solutions to nonlinear DSGE models. \ As coded here, these two methods
employ the same model form but differ in how the solution is computed. \ To
employ either method the DSGE model is first expressed in the form%
\[
\text{E}_{t}\mathbf{G}\left( \mathbf{x}_{t},\mathbf{y}_{t},\mathbf{x}_{t+1},%
\mathbf{y}_{t+1}\right) =\mathbf{0}. 
\]%
\ With $\mathbf{x}_{t}$ containing $n_{x}$ predetermined variables and $%
\mathbf{y}_{t}$ containing $n_{y}$ non-predetermined variables, $\mathbf{G}%
() $ is a vector containing $n_{x}+n_{y}$ functions. \ Bundling $x_{t}$ and $%
y_{t}$ into a new vector $\mathbf{z}_{t}=\left[ 
\begin{array}{cc}
\mathbf{x}_{t}^{^{\prime }} & \mathbf{y}_{t}^{^{\prime }}%
\end{array}%
\right] ^{^{\prime }}$ and bundling $\mathbf{z}_{t}$ and $\mathbf{z}_{t+1}$
into a new vector $\mathbf{p}_{t}=\left[ 
\begin{array}{cc}
\mathbf{z}_{t}^{^{\prime }} & \mathbf{z}_{t+1}^{^{\prime }}%
\end{array}%
\right] ^{^{\prime }}$ we get%
\[
\text{E}_{t}\mathbf{G}\left( \mathbf{p}_{t}\right) =\mathbf{0}. 
\]%
We now approximate $\mathbf{G}\left( \mathbf{p}_{t}\right) $ around the
deterministic steady state, $\overline{\mathbf{p}}$, using a second-order
Taylor expansion giving%
\[
\mathbf{G}\left( \mathbf{p}_{t}\right) \simeq \mathbf{G}_{p}\left( \mathbf{p}%
_{t}-\overline{\mathbf{p}}\right) +\left[ \mathbf{I}\otimes \left( \mathbf{p}%
_{t}-\overline{\mathbf{p}}\right) \right] ^{^{\prime }}\mathbf{G}_{pp}\left[ 
\mathbf{I}\otimes \left( \mathbf{p}_{t}-\overline{\mathbf{p}}\right) \right]
=\mathbf{0}, 
\]%
where $\mathbf{G}_{p}$ is a matrix of first-derivatives and $\mathbf{G}_{pp}$
is a matrix of stacked Hessians, one Hessian for each of the $n_{x}+n_{y}$
equations.

We now recognize that some elements of $\mathbf{x}_{t}$ (usually the first $%
s $ elements) are shocks that have the form%
\[
\mathbf{s}_{t+1}=\mathbf{\Lambda s}_{t}+\mathbf{\eta \epsilon }_{t+1}, 
\]%
where $\mathbf{\epsilon }_{t}\sim i.i.d.[\mathbf{0},\mathbf{\Sigma }]$. \
The essential components required for a second-order-accurate solution are
now given by $n_{x}$, $n_{y}$, $\mathbf{G}_{p}$, $\mathbf{G}_{pp}$, $\mathbf{%
\eta }$, and $\mathbf{\Sigma }$.

The two model types that we consider for second-order-accurate solution
methods are

\begin{itemize}
\item \textbf{Gomme\_Klein\_Form}

\item \textbf{Lombardo\_Sutherland\_Form}
\end{itemize}

\subsubsection{Gomme-Klein form}

To compute a second-order accurate solution using the Gomme and Klein (2011)
method we summarize the model in the form of the \textbf{Gomme\_Klein\_Form}
composite type. \ Once this model type is constructed the model can be
solved. \ The code to compute the solution would be something like

\bigskip

\textbf{cutoff = 1.0}

\textbf{model = Gomme\_Klein\_Form(nx,ny,Gp,Gpp,eta,sigma)}

\textbf{soln = solve\_re(model,cutoff)}

\bigskip

Here \textbf{soln} is a composite type that contains the solution, which is
of the form%
\begin{eqnarray*}
\mathbf{x}_{t+1}-\overline{\mathbf{x}} &=&\frac{1}{2}\mathbf{ssh}+\mathbf{hx}%
\left( \mathbf{x}_{t}-\overline{\mathbf{x}}\right) +\frac{1}{2}\left[ 
\mathbf{I}\otimes \left( \mathbf{x}_{t}-\overline{\mathbf{x}}\right) \right]
^{^{\prime }}\mathbf{hxx}\left[ \mathbf{I}\otimes \left( \mathbf{x}_{t}-%
\overline{\mathbf{x}}\right) \right] +\mathbf{\eta \epsilon }_{t+1}, \\
\mathbf{y}_{t}-\overline{\mathbf{y}} &=&\frac{1}{2}\mathbf{ssg}+\mathbf{gx}%
\left( \mathbf{x}_{t}-\overline{\mathbf{x}}\right) +\frac{1}{2}\left[ 
\mathbf{I}\otimes \left( \mathbf{x}_{t}-\overline{\mathbf{x}}\right) \right]
^{^{\prime }}\mathbf{gxx}\left[ \mathbf{I}\otimes \left( \mathbf{x}_{t}-%
\overline{\mathbf{x}}\right) \right] ,
\end{eqnarray*}%
where $\mathbf{hxx}$ and $\mathbf{gxx}$ are stacked matrices containing the
second order coefficients for each of the $n_{x}$ and $n_{y}$ equations,
respectively. \ \textbf{soln} also contains information about the number of
eigenvalues with modulus greater than cutoff and the solution's determinacy
properties, where these properties are associated with the model first-order
dynamics.

\subsubsection{Lombardo-Sutherland form}

Implementing the Lombardo and Sutherland (2007) solution method is no
different than for Gomme and Klein (2010). \ The key difference is the form
in which the solution is presented. \ Ths code to implement the
Lombardo-Sutherland method would look something like

\bigskip

\textbf{cutoff = 1.0}

\textbf{model = Lombardo\_Sutherland\_Form(nx,ny,Gp,Gpp,eta,sigma)}

\textbf{soln = solve\_re(model,cutoff)}

\bigskip

where now the solution has the form%
\begin{eqnarray*}
\mathbf{x}_{t+1}-\overline{\mathbf{x}} &=&\frac{1}{2}\mathbf{ssh}+\mathbf{hx}%
\left( \mathbf{x}_{t}-\overline{\mathbf{x}}\right) +\frac{1}{2}\mathbf{hxx}%
\times \mathbf{v}_{t}+\mathbf{\eta \epsilon }_{t+1}, \\
\mathbf{y}_{t}-\overline{\mathbf{y}} &=&\frac{1}{2}\mathbf{ssg}+\mathbf{gx}%
\left( \mathbf{x}_{t}-\overline{\mathbf{x}}\right) +\frac{1}{2}\mathbf{gxx}%
\times \mathbf{v}_{t}, \\
\mathbf{v}_{t} &=&\mathbf{\Phi v}_{t-1}+\mathbf{\Gamma }vech\left( \mathbf{%
\epsilon }_{t}\mathbf{\epsilon }_{t}^{^{\prime }}\right) +\mathbf{\Psi }%
vec\left( \mathbf{x}_{t}\mathbf{\epsilon }_{t}^{^{\prime }}\right) ,
\end{eqnarray*}%
with $\mathbf{v}_{t}$ given by%
\[
\mathbf{v}_{t}=vech\left( \mathbf{x}_{t}\mathbf{x}_{t}^{\prime }\right) . 
\]

The solution form produced by the Lombardo-Sutherland method can be
converted into that produced by the Gomme-Klein method by using the \textbf{%
convert\_second\_order} function as follows

\bigskip

\textbf{new\_soln = convert\_second\_order(soln)}

\bigskip

Where \textbf{soln} is of type \textbf{Lombardo\_Sutherland\_Soln}, \textbf{%
new\_soln} is of type \textbf{Gomme\_Klein\_Soln}.

\section{Solving optimal policy problems}

SolveDSGE provides routines for solving Linear-Quadratic (LQ) optimal policy
problems. \ These LQ problems allow policy to be conducted under:
discretion; commitment; quasi-commitment; and timeless-perspective
commitment. \ The solutions to these four policy problems are obtained using
the commands \textbf{solve\_disc()}, \textbf{solve\_commit()}, \textbf{%
solve\_quasi()}, and \textbf{solve\_timeless()}, respectively. \ The optimal
policy routines are based around four model types and two solution types. \
At this stage not all of these policies are supported for all model-types. \
The four model-types and the optimal policies that they support are
documented below.

\subsection{State space form}

The LQ optimal policy problem in \textbf{State\_Space\_Form} is described by
the quadratic objective function%
\[
Loss=\text{E}\left[ \dsum\limits_{t=0}^{\infty }\beta ^{t}\left( \mathbf{z}%
_{t}^{^{\prime }}\mathbf{Qz}_{t}+\mathbf{z}_{t}^{^{\prime }}\mathbf{Uu}_{t}+%
\mathbf{u}_{t}^{^{\prime }}\mathbf{U}^{^{\prime }}\mathbf{z}_{t}+\mathbf{u}%
_{t}^{^{\prime }}\mathbf{Ru}_{t}\right) \right] , 
\]%
and the linear constraints%
\[
\left[ 
\begin{array}{c}
\mathbf{x}_{t+1} \\ 
\text{E}_{t}\mathbf{y}_{t+1}%
\end{array}%
\right] =\mathbf{A}\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{y}_{t}%
\end{array}%
\right] +\mathbf{Bu}_{t}+\mathbf{C}\left[ \mathbf{\epsilon }_{t+1}\right] , 
\]%
where $\mathbf{x}_{t}$ contains $n_{x}$ predetermined variables, $\mathbf{y}%
_{t}$ contains $n_{y}$ non-predetermined variables, $\mathbf{u}_{t}$
contains $n_{p}$ policy instruments, and $\mathbf{\epsilon }_{t}$ contains $%
n_{s}$ stochastic innovations.

For this model form the following policies are supported:

\begin{itemize}
\item Discretion $\left( \mathbf{s}_{t}=\mathbf{x}_{t}\right) $

\item Commitment $\left( \mathbf{s}_{t}=\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{\lambda }_{t}%
\end{array}%
\right] \right) $

\item Quasi-commitment $\left( \mathbf{s}_{t}=\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{\lambda }_{t}%
\end{array}%
\right] \right) $

\item Timeless-perspective commitment $\left( \mathbf{s}_{t}=\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{x}_{t-1} \\ 
\mathbf{u}_{t-1}%
\end{array}%
\right] \right) $
\end{itemize}

For each policy the solution returned is of the form%
\begin{eqnarray*}
\mathbf{s}_{t+1} &=&\mathbf{Ps}_{t}+\mathbf{K\epsilon }_{t+1}, \\
\mathbf{z}_{t} &=&\mathbf{Hs}_{t}, \\
\mathbf{u}_{t} &=&\mathbf{Fs}_{t}.
\end{eqnarray*}%
with this information summarized in the solution type, \textbf{%
State\_Space\_Soln}.

To solve a model for each of the policies above we would use code like the
following

\bigskip

\textbf{obj = State\_Space\_Objective(beta,q,u,r)}

\textbf{model = State\_Space\_Form(nx,ny,a,b,c,sigma)}

\textbf{tol = 1e-10}

\textbf{maxiters = 100}

\textbf{commit\_prob = 0.75}

\textbf{soln\_disc = solve\_disc(model,obj,tol,maxiters)}

\textbf{soln\_commit = solve\_commit(model,obj,tol,maxiters)}

\textbf{soln\_quasi = solve\_quasi(model,obj,commit\_prob,tol,maxiters)}

\textbf{soln\_timeless = solve\_timeless(model,obj,tol,maxiters)}

\bigskip

\subsection{Generalized state space form}

The LQ optimal policy problem in \textbf{Generalized\_State\_Space\_Form} is
described by the quadratic objective function%
\[
Loss=\text{E}\left[ \dsum\limits_{t=0}^{\infty }\beta ^{t}\left( \mathbf{z}%
_{t}^{^{\prime }}\mathbf{Qz}_{t}+\mathbf{z}_{t}^{^{\prime }}\mathbf{Uu}_{t}+%
\mathbf{u}_{t}^{^{\prime }}\mathbf{U}^{^{\prime }}\mathbf{z}_{t}+\mathbf{u}%
_{t}^{^{\prime }}\mathbf{Ru}_{t}\right) \right] , 
\]%
and the linear constraints%
\[
\left[ 
\begin{array}{c}
\mathbf{x}_{t+1} \\ 
\mathbf{A}_{0}\text{E}_{t}\mathbf{y}_{t+1}%
\end{array}%
\right] =\mathbf{A}\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{y}_{t}%
\end{array}%
\right] +\mathbf{Bu}_{t}+\mathbf{C}\left[ \mathbf{\epsilon }_{t+1}\right] , 
\]%
where $\mathbf{x}_{t}$ contains $n_{x}$ predetermined variables, $\mathbf{y}%
_{t}$ contains $n_{y}$ non-predetermined variables, $\mathbf{u}_{t}$
contains $n_{p}$ policy instruments, and $\mathbf{\epsilon }_{t}$ contains $%
n_{s}$ stochastic innovations. \ The \textbf{Generalized\_State\_Space\_Form}
differs from the \textbf{State\_Space\_Form} above through the presence of
the (usually) singular leading matrix $\mathbf{A}_{0}$.

For this model form the following policies are supported:

\begin{itemize}
\item Discretion $\left( \mathbf{s}_{t}=\mathbf{x}_{t}\right) $

\item Commitment $\left( \mathbf{s}_{t}=\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{\lambda }_{t}%
\end{array}%
\right] \right) $

\item Quasi-commitment $\left( \mathbf{s}_{t}=\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{\lambda }_{t}%
\end{array}%
\right] \right) $

\item Timeless-perspective commitment $\left( \mathbf{s}_{t}=\left[ 
\begin{array}{c}
\mathbf{x}_{t} \\ 
\mathbf{x}_{t-1} \\ 
\mathbf{u}_{t-1}%
\end{array}%
\right] \right) $
\end{itemize}

For each policy the solution returned is of the form%
\begin{eqnarray*}
\mathbf{s}_{t+1} &=&\mathbf{Ps}_{t}+\mathbf{K\epsilon }_{t+1}, \\
\mathbf{z}_{t} &=&\mathbf{Hs}_{t}, \\
\mathbf{u}_{t} &=&\mathbf{Fs}_{t}.
\end{eqnarray*}%
with this information summarized in the solution type, \textbf{%
State\_Space\_Soln}.

To solve a model for each of the policies above we would use code like the
following

\bigskip

\textbf{obj = State\_Space\_Objective(beta,q,u,r)}

\textbf{model = Generalized\_State\_Space\_Form(nx,ny,a0,a,b,c,sigma)}

\textbf{tol = 1e-10}

\textbf{maxiters = 100}

\textbf{commit\_prob = 0.75}

\textbf{soln\_disc = solve\_disc(model,obj,tol,maxiters)}

\textbf{soln\_commit = solve\_commit(model,obj,tol,maxiters)}

\textbf{soln\_quasi = solve\_quasi(model,obj,commit\_prob,tol,maxiters)}

\textbf{soln\_timeless = solve\_timeless(model,obj,tol,maxiters)}

\bigskip

\subsection{Structural form}

The LQ optimal policy problem in \textbf{Structural\_Form} is described by
the quadratic objective function%
\[
Loss=\text{E}\left[ \dsum\limits_{t=0}^{\infty }\beta ^{t}\left( \mathbf{y}%
_{t}^{^{\prime }}\mathbf{Qy}_{t}+\mathbf{u}_{t}^{^{\prime }}\mathbf{Ru}%
_{t}\right) \right] , 
\]%
and the linear constraints%
\[
\mathbf{A}_{0}\mathbf{y}_{t}=\mathbf{A}_{1}\mathbf{y}_{t-1}+\mathbf{A}_{2}%
\text{E}_{t}\mathbf{y}_{t+1}+\mathbf{A}_{3}\mathbf{u}_{t}+\mathbf{A}_{5}%
\mathbf{\epsilon }_{t}, 
\]%
where $\mathbf{y}_{t}$ contains $n$ variables, $\mathbf{u}_{t}$ contains $%
n_{p}$ policy instruments, and $\mathbf{\epsilon }_{t}$ contains $n_{s}$
stochastic innovarions.

For this model form the following policies are supported:

\begin{itemize}
\item Discretion $\left( \mathbf{s}_{t-1}=\mathbf{y}_{t-1}\right) $

\item Commitment $\left( \mathbf{s}_{t-1}=\left[ 
\begin{array}{c}
\mathbf{y}_{t-1} \\ 
\mathbf{\lambda }_{t-1}%
\end{array}%
\right] \right) $
\end{itemize}

For each policy the returned solution is of the form%
\begin{eqnarray*}
\mathbf{s}_{t} &=&\mathbf{Ps}_{t-1}+\mathbf{K\epsilon }_{t}, \\
\mathbf{u}_{t} &=&\mathbf{Fs}_{t-1}.
\end{eqnarray*}%
with this information contained in the solution type, \textbf{%
Structural\_Soln}.

To solve a model for each of the policies above we would use code like the
following

\bigskip

\textbf{obj = Structural\_Objective(beta,q,r)}

\textbf{model = Structural\_Form(a0,a1,a2,a3,a5,sigma)}

\textbf{tol = 1e-10}

\textbf{maxiters = 100}

\textbf{soln\_disc = solve\_disc(model,obj,tol,maxiters)}

\textbf{soln\_commit = solve\_commit(model,obj,tol,maxiters)}

\bigskip

\subsection{Generalized structural form}

The LQ optimal policy problem in \textbf{Generalized\_Structural\_Form} is
described by the quadratic objective function%
\[
Loss=\text{E}\left[ \dsum\limits_{t=0}^{\infty }\beta ^{t}\left( \mathbf{y}%
_{t}^{^{\prime }}\mathbf{Qy}_{t}+\mathbf{u}_{t}^{^{\prime }}\mathbf{Ru}%
_{t}\right) \right] , 
\]%
and the linear constraints%
\[
\mathbf{A}_{0}\mathbf{y}_{t}=\mathbf{A}_{1}\mathbf{y}_{t-1}+\mathbf{A}_{2}%
\text{E}_{t}\mathbf{y}_{t+1}+\mathbf{A}_{3}\mathbf{u}_{t}+\mathbf{A}_{4}%
\text{E}_{t}\mathbf{u}_{t+1}+\mathbf{A}_{5}\mathbf{\epsilon }_{t}, 
\]%
where $\mathbf{y}_{t}$ contains $n$ variables, $\mathbf{u}_{t}$ contains $%
n_{p}$ policy instruments, and $\mathbf{\epsilon }_{t}$ contains $n_{s}$
stochastic innovarions.

For this model form the following policies are supported:

\begin{itemize}
\item Discretion $\left( \mathbf{s}_{t-1}=\mathbf{y}_{t-1}\right) $

\item Commitment $\left( \mathbf{s}_{t-1}=\left[ 
\begin{array}{c}
\mathbf{y}_{t-1} \\ 
\mathbf{\lambda }_{t-1}%
\end{array}%
\right] \right) $
\end{itemize}

For each policy the returned solution is of the form%
\begin{eqnarray*}
\mathbf{s}_{t} &=&\mathbf{Ps}_{t-1}+\mathbf{K\epsilon }_{t}, \\
\mathbf{u}_{t} &=&\mathbf{Fs}_{t-1}.
\end{eqnarray*}%
with this information contained in the solution type, \textbf{%
Structural\_Soln}.

To solve a model for each of the policies above we would use code like the
following

\bigskip

\textbf{obj = Structural\_Objective(beta,q,r)}

\textbf{model = Generalized\_Structural\_Form(a0,a1,a2,a3,a4,a5,sigma)}

\textbf{tol = 1e-10}

\textbf{maxiters = 100}

\textbf{soln\_disc = solve\_disc(model,obj,tol,maxiters)}

\textbf{soln\_commit = solve\_commit(model,obj,tol,maxiters)}

\bigskip

\setlength{\baselineskip}{10pt}

\begin{thebibliography}{9}
\bibitem{} Binder, M., and H. Pesaran, (1995), \textquotedblleft
Multivariate Rational Expectations Models and Macroeconomic Modeling: A
Review and Some New Results,\textquotedblright\ in: Pesaran, H., M. Wickens,
(Eds.), \textit{Handbook of Applied Econometrics}, Basil Blackwell, Oxford,
pp.139--187.

\bibitem{} Blanchard, O., and C. Kahn, (1980), \textquotedblleft The
Solution to Linear Difference Models under Rational
Expectations,\textquotedblright\ \textit{Econometrica}, 48, pp.1305--1311.

\bibitem{} Gomme, P., and P. Klein, (2011), \textquotedblleft Second-Order
Approximation of Dynamic Models Without the Use of
Tensors,\textquotedblright\ \textit{Journal of Economic Dynamics and Control}%
, 35, pp.604--615.

\bibitem{} Klein, P., (2000), \textquotedblleft Using the Generalized Schur
Form to Solve a Multivariate Linear Rational Expectations
Model,\textquotedblright\ \textit{Journal of Economic Dynamics and Control},
24, pp.1405--1423.

\bibitem{} Lombardo, G., and A. Sutherland, (2007), \textquotedblleft
Computing Second-Order-Accurate Solutions for Rational Expectations models
Using Linear Solution Methods,\textquotedblright\ \textit{Journal of
Economic Dynamics and Control}, 31, pp.515--530.

\bibitem{} Sims, C., (2001), \textquotedblleft Solving Linear Rational
Expectations Models,\textquotedblright\ \textit{Computational Economics},
20, pp.1--20.
\end{thebibliography}

\end{document}
